fix: bound Redis usage idempotency cache - #738
Conversation
|
Warning Review limit reached
More reviews will be available in 49 minutes and 41 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthrough
Changes로컬 idempotency 캐시 프루닝 및 퇴출
🎯 2 (Simple) | ⏱️ ~12 minutes🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📊 Benchmark Results❌ Some benchmarks failed
Updated: 2026-06-14T21:57:01.878Z · Commit: 490464e |
1ce9db2 to
efd17cf
Compare
efd17cf to
b49666a
Compare
Summary
Fixes #704.
RedisUsageStoragenow keeps its process-local record idempotency short-circuit cache bounded. Expired local keys are pruned opportunistically during later quota writes/checks, and a full cache evicts the oldest local entries before accepting new unique keys. Redis remains the idempotency source of truth.변경 사항
@croco/metering-core.Verification
pnpm test --filter=@croco/metering-core- passed, 13 files / 156 tests. Pre-push fullpnpm testalso passed, 197 tasks.pnpm typecheck --filter=@croco/metering-core- passed. Pre-push fullpnpm typecheckalso passed, 196 tasks.pnpm check- passed.pnpm exec changeset status --since origin/trunk- passed and reports patch bumps for@croco/metering-coreand dependent packages.git diff --cached --check- passed.Self-review
RedisUsageStorage.spec.tsfake-timer pruning and max-size tests; existing duplicate short-circuit behavior remains covered by the existing idempotency test.RedisUsageStorage, its focused tests, and release metadata; it reuses the existing Map and adds a small local policy instead of a new dependency or cross-package abstraction.Risk
Low. Processes that exceed 10,000 unique local record idempotency keys may perform more Redis evals for older duplicates after local eviction, but Redis idempotency still preserves correctness.
Summary by CodeRabbit
개선사항
테스트